<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>合作商信息-修改</title>
    <meta name="description" content="这是一个用户信息页面">
    <meta name="keywords" content="用户信息">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="renderer" content="webkit">
    <meta http-equiv="Cache-Control" content="no-siteapp"/>
    <link rel="icon" type="image/png" href="${contextPath}/assets/i/favicon.png">
    <link rel="apple-touch-icon-precomposed" href="${contextPath}/assets/i/app-icon72x72@2x.png">
    <meta name="apple-mobile-web-app-title" content="Amaze UI"/>
    <link rel="stylesheet" href="${contextPath}/assets/css/amazeui.min.css"/>
    <link rel="stylesheet" href="${contextPath}/assets/css/amazeui.datatables.min.css"/>
    <link rel="stylesheet" href="${contextPath}/assets/css/app.css">
    <script src="${contextPath}/assets/js/jquery.min.js"></script>

</head>

<body data-type="widgets">
<script src="${contextPath}/assets/js/theme.js"></script>
<div class="am-g tpl-g">
    <!-- 头部 -->
    <#include "/pc/common/header.html" />
    <!-- 侧边导航栏 -->
    <#include "/pc/common/left.html" />
    <!-- 内容区域 -->
    <div class="tpl-content-wrapper">
        <div class="row-content am-cf">
            <div class="row">
                <div class="am-u-sm-12 am-u-md-12 am-u-lg-12">
                    <div class="widget am-cf">
                        <ol class="am-breadcrumb widget-head">
                            <li><a href="${contextPath}/index.htm" class="am-icon-home">首页</a></li>
                            <li>系统管理</li>
                            <li><a href="${contextPath}/merchant/list.htm">合作商管理</a></li>
                            <#if merchant?? && merchant.id??>
                                    <li>修改</li>
                                <#else>
                                    <li>新增</li>
                            </#if>
                        </ol>
                        <div class="widget-body  am-fr">
                            <div class="am-u-sm-12">
                                <form class="am-form am-form-horizontal" enctype="multipart/form-data"
                                      action="${contextPath}/merchant/save.htm" method="post" id="myform">
                                    <fieldset>
                                        <#if merchant?? && merchant.id??>
                                            <input type="hidden" name="id" value="${merchant.id!}">
                                        </#if>
                                        <div class="am-form-group am-g">
                                            <label for="mtname" class="am-u-sm-2 am-form-label">合作商名称</label>
                                            <div class="am-u-sm-4">
                                                <input type="text" id="mtname" name="mtname" placeholder="输入合作商名称"
                                                       value="${merchant.mtname!''}">
                                            </div>
                                            <label for="cityid"
                                                   class="am-u-sm-2 am-form-label">所属城市</label>
                                            <div class="am-u-sm-4">
                                                <select id="cityid" name="cityid" class="xb_a" style="margin-left:0px;">
                                                    <#if merchant.cityid??>
                                                        <#assign cityid="${merchant.cityid?c}" />
                                                    </#if>
                                                    <#if Session.manager_js == 2>
                                                            ${dict.getCityOptions(cityid!)}
                                                        <#elseif Session.manager_js == 3>
                                                            <option selected value="${Session.manager_user.cityid?c}">${dict.getCityName(Session.manager_user.cityid?c)}</option>
                                                    </#if>
                                                </select>
                                            </div>
                                        </div>

                                        <div class="am-form-group am-g">
                                            <label for="provincename" class="am-u-sm-2 am-form-label">所在地区</label>
                                            <div class="am-u-sm-4" style="padding-left: 0px;padding-right: 0px;">
                                                <div class="am-u-sm-4">
                                                    <select class="xb_a" onchange="selectCity(this,'${merchant.cityname!'null'}')" id="provincename" name="provincename" placeholder="选择所在省份" style="margin-left:0px;">
                                                        <option>请选择</option>
                                                    </select>
                                                </div>
                                                <div class="am-u-sm-4">
                                                    <select class="xb_a" onchange="selectRegion(this,'${merchant.regionname!'null'}')" id="cityname" name="cityname" placeholder="选择所在城市" style="margin-left:0px;">
                                                        <option>${merchant.cityname!'请选择'}</option>
                                                    </select>
                                                </div>
                                                <div class="am-u-sm-4">
                                                    <select class="xb_a" id="regionname" type="text" name="regionname"
                                                            placeholder="选择所在区县市" style="margin-left:0px;">
                                                        <option>${merchant.regionname!'请选择'}</option>
                                                    </select>
                                                </div>
                                            </div>
                                            <label for="provincename" class="am-u-sm-2 am-form-label">所在地详细地址</label>
                                            <div class="am-u-sm-4">
                                                <input type="text" id="addr" name="addr"
                                                       value="${merchant.addr!''}" placeholder="输入所在地详细地址">
                                            </div>
                                        </div>

                                        <div class="am-form-group am-g">
                                            <label for="lng"
                                                   class="am-u-sm-2 am-form-label">所在经度</label>
                                            <div class="am-u-sm-4">
                                                <input id="lng" type="number" name="lng"
                                                       placeholder="输入所在经度" value="${merchant.lng!''}">
                                            </div>
                                            <label for="lat"
                                                   class="am-u-sm-2 am-form-label">所在纬度</label>
                                            <div class="am-u-sm-4">
                                                <input type="number" id="lat" name="lat"
                                                       value="${merchant.lat!''}" placeholder="输入所在纬度">
                                            </div>
                                        </div>

                                        <div class="am-form-group am-g">
                                            <label for="contact"
                                                   class="am-u-sm-2 am-form-label">负责人姓名</label>
                                            <div class="am-u-sm-4">
                                                <input id="contact" type="text" name="contact"
                                                       placeholder="输入负责人姓名" value="${merchant.contact!''}">
                                            </div>
                                            <label for="tel"
                                                   class="am-u-sm-2 am-form-label">负责人手机号</label>
                                            <div class="am-u-sm-4">
                                                <input type="text" id="tel" name="tel"
                                                       value="${merchant.tel!''}" placeholder="输入负责人手机号">
                                            </div>
                                        </div>

                                        <div class="am-form-group am-g">
                                            <label for="landline"
                                                   class="am-u-sm-2 am-form-label">店内座机</label>
                                            <div class="am-u-sm-4">
                                                <input id="landline" type="text" name="landline"
                                                       placeholder="输入店内座机" value="${merchant.landline!''}">
                                            </div>
                                            <label for="clearprop"
                                                   class="am-u-sm-2 am-form-label">抽成比例%</label>
                                            <div class="am-u-sm-4">
                                                <input id="clearprop" type="text" name="clearprop" onkeyup="CheckInputIntFloat(this)"
                                                       placeholder="输入抽成比例" value="${merchant.clearprop!''}">
                                            </div>
                                        </div>
                                        <div class="am-form-group am-g">
                                            <label for="mtimg"
                                                   class="am-u-sm-2 am-form-label">合作商图标</label>
                                            <div class="am-u-sm-4">
                                                <div id="mtimg" name="mtimg" value="${merchant.mtimg!''}" class="am-form-group am-form-file" style="padding-left: 0px;">
                                                    <button type="button" class="am-btn am-btn-danger am-btn-sm">
                                                        <i class="am-icon-cloud-upload"></i> 选择要上传的文件</button>
                                                    <input id="doc-form-file" type="file" name="file">
                                                </div>
                                                <div id="file-list">
                                                    <#if merchant.mtimg?? && merchant.mtimg!=''>
                                                        <img class="am-radius" src="${contextPath}/${merchant.mtimg!}" height="100" />
                                                    </#if>
                                                </div>
                                                <script>
                                                    $(function() {
                                                        $('#doc-form-file').on('change', function() {
                                                            var fileNames = '';
                                                            $.each(this.files, function() {
                                                                fileNames += '<span class="am-badge">' + this.name + '</span> ';
                                                            });
                                                            $('#file-list').html(fileNames);
                                                        });
                                                    });
                                                </script>
                                            </div>
                                            <div class="am-u-sm-6"></div>
                                        </div>

                                        <div class="am-u-sm-offset-5">
                                            <button type="submit" class="am-btn am-btn-primary">
                                                保存
                                            </button>
                                            <a href="javascript:history.back();"
                                               class="am-btn am-btn-default">返回</a>
                                        </div>
                                    </fieldset>
                                </form>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
</div>
<#include "/pc/common/alert.html" />
<script src="${contextPath}/assets/js/amazeui.min.js"></script>
<script src="${contextPath}/assets/js/amazeui.datatables.min.js"></script>
<script src="${contextPath}/assets/js/dataTables.responsive.min.js"></script>
<script src="${contextPath}/assets/js/amazeui.page.js"></script>
<script src="${contextPath}/assets/js/app.js"></script>
<script>
    $(document).ready(function(){
        selectProvince('${merchant.provincename!}');
    });
function selectProvince(def){
    $.ajax({
        url:"${contextPath}/tag/province.htm?def="+def,
        type:"get",
        success:function(data){
            if(data){
                $("#provincename").html(data);
            }
        }
    });
}

function selectCity(obj,def){
    var name = $(obj).val();
    $.ajax({
        url:"${contextPath}/tag/city.htm?def="+def+"&name="+name,
        type:"get",
        success:function(data){
            if(data){
                $("#cityname").html(data);
                $("#regionname").html("<option>请选择</option>");
            }
        }
    });
}

function selectRegion(obj,def){
    var name = $(obj).val();
    $.ajax({
        url:"${contextPath}/tag/region.htm?def="+def+"&name="+name,
        type:"get",
        success:function(data){
            if(data){
                $("#regionname").html(data);
            }
        }
    });
}
    function CheckInputIntFloat(oInput)
    {
        if('' != oInput.value.replace(/\d{1,}\.{0,1}\d{0,}/,''))
        {
            oInput.value = oInput.value.match(/\d{1,}\.{0,1}\d{0,}/) == null ? '' :oInput.value.match(/\d{1,}\.{0,1}\d{0,}/);
        }
    }
</script>
</body>

</html>